package com.taotao.portal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.taotao.portal.service.ItemService;
import com.taotao.rest.webservice.Item;

@Controller
public class ItemController {
	
	@Autowired
	private ItemService itemService;
	@RequestMapping(value="/item/{item_id}")
	public ModelAndView showItem(@PathVariable long item_id) {
		ModelAndView mav = new ModelAndView("item");
		Item item = itemService.getItemBaseInfo(item_id);
		mav.addObject("item", item);
		return mav;
	}
	
	@RequestMapping(value="/item/desc/{id}", produces="text/html;charset=UTF-8")
	@ResponseBody
	public String getItemDesc(@PathVariable long id) {
		String itemDesc = itemService.getItemDesc(id).getDesc();
		return itemDesc;
		
	}
}
